<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use App\Models\Parish;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;

class ParishController extends Controller
{
    //
    public function getlist(Request $request){
        $model = Parish::query();
        $diocese_id = $request->input('diocese_id');
        if($diocese_id){
            $model->where('diocese_id',$diocese_id);
        }
        $list = $model->get();        
        return new ResourceCollection($list);
    }
}
